# Contributor: Thomas Boerger <thomas@webhippie.de>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=pgcli
pkgver=4.0.1
pkgrel=1
pkgdesc="Postgres CLI with autocompletion and syntax highlighting"
url="https://www.pgcli.com"
arch="noarch"
license="BSD-3-Clause"
depends="python3
	py3-cli_helpers>1.0.0
	py3-click
	py3-configobj
	py3-humanize
	py3-gpep517
	py3-pendulum
	py3-pgspecial
	py3-prompt_toolkit>2.0.0
	py3-psycopg-c
	py3-pygments
	py3-setproctitle
	py3-setuptools
	py3-sqlparse<0.5.0
	py3-wcwidth
	py3-wheel
	"
checkdepends="pytest py3-mock"
makedepends="python3-dev"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/p/pgcli/pgcli-$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest --ignore=tests/test_ssh_tunnel.py
	# sshtunnel module is not yet packaged
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
27281f97a5666e81cb70249d40350f3809819ab5305dd792747db16827e8444268427f8fa07ab50cafde8530587f34125ef875516e0b39d0b80d5b8e0f2a8380  pgcli-4.0.1.tar.gz
"
